package com.ctshk.rpc.payment.dto.req.wechat;

import com.alibaba.fastjson.annotation.JSONField;
import com.ctshk.rpc.payment.dto.WeChatPayConfig;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @BelongsProject: ctshk-cloud
 * @BelongsPackage: com.ctshk.rpc.payment.dto.req.wechat
 * @Author: hef
 * @CreateTime: 2021-05-08 14:06
 * @Description: 描述
 */
@Data
public class WeChatPayTransactionReq extends WeChatPayCommonReq {
    /**
     * 交易金额 单位分
     */
    @JSONField(name = "total_fee")
    private Long totalFee;
    /**
     * 商品或支付单简要描述
     */
    private String body;
    /**
     * 声明商户订单号，不填则由 payment 生成订单号，同一商户号该订单号下不可重复
     */
    @JSONField(name = "out_trade_no")
    private String outTradeNo;
    /**
     * 支付成功的回调路径
     */
    @JSONField(name = "notify_url")
    private String notifyUrl;
    /**
     * 应用的 appId
     */
    @JSONField(name = "sub_appid")
    private String subAppid;

    public WeChatPayTransactionReq(String method, WeChatPayConfig config,
                                   BigDecimal totalFee, String body, String outTradeNo) {
        super(method, config);
        this.totalFee = totalFee.longValue();
        this.body = body;
        this.outTradeNo = outTradeNo;
        this.notifyUrl = config.getNotifyUrl();
    }
}
